﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WenSkin.Controls
{
    public class WenButtonClose : WenControl
    {
        public WenButtonClose()
        {
            this.Size = new Size(30, 30);
            this.Paint += WenButtonClose_Paint;
            this.MouseEnter += WenButtonClose_MouseEnter;
            this.MouseLeave += WenButtonClose_MouseLeave;
        }

        private void WenButtonClose_MouseLeave(object sender, EventArgs e)
        {
            BackColor = Color.Transparent;
        }

        private void WenButtonClose_MouseEnter(object sender, EventArgs e)
        {
            BackColor = Color.FromArgb(63, 63, 65);
        }

        private void WenButtonClose_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
        {
            Graphics g = e.Graphics.SetGDIHigh();

            using Pen p = new Pen(Color.White, 1);

            int z = Width > Height ? Height : Width / 2;

            Rectangle rec = new Rectangle((this.Width - z) / 2, (this.Height - z) / 2, z, z);

            g.DrawLine(p, rec.X, rec.Y, rec.X + rec.Width, rec.Y + rec.Height);
            g.DrawLine(p, rec.X, rec.Y + rec.Height, rec.X + rec.Width, rec.Y);
        }
    }
}